CC=g++ -std=c++11
FLAGS=-g -Wall

LIBS=-lpthread -lrt -L../lib -lthostmduserapi -lthosttraderapi -L../lib -lwebsockets

INCS=-I../include -I../include/ctp -I../tnet -I../tnet/http -I../tnet/polarssl

VPATH=../tnet:../tnet/http:../tnet/polarssl:../tnet/redis

OBJ_DIR=./obj
SRCS=$(wildcard *.cpp) $(wildcard ../tnet/*.cpp) $(wildcard ../tnet/polarssl/*.cpp) $(wildcard ../tnet/redis/*.cpp) $(wildcard ../tnet/http/*.cpp)
OBJS=$(patsubst %.cpp, $(OBJ_DIR)/%.o, $(notdir ${SRCS}) )

C_SRCS=$(wildcard ../tnet/http/*.c) $(wildcard ../tnet/polarssl/*.c) $(wildcard ../tnet/redis/*.c)
C_OBJS=$(patsubst %.c, $(OBJ_DIR)/%.o, $(notdir ${C_SRCS})) 

BIN_DIR=./bin

TARGET=QiZhiServer 

$(BIN_DIR)/$(TARGET):$(OBJS) $(C_OBJS)
	$(CC) $(FLAGS) -o $@ $^ $(LIBS)  
$(OBJ_DIR)/%.o:%.cpp
	$(CC) -c $(FLAGS) $(INCS) $< -o $@ 
$(OBJ_DIR)/%.o:%.c
	$(CC) -c $(FLAGS) $(INCS) $< -o $@


clean:
	-rm -f $(OBJ_DIR)/*.o



